package com.yh.hljapp.gddb.gdbean;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToMany;

import java.util.List;

/**
 * =========================
 * 版权所有，违法必究
 * 作者：john
 * <p>
 * 工程：FoodBarcode
 * <p>
 * 文件名：MatHead
 * <p>
 * 创建时间：2017.06.02.16:48
 * *****************************
 */
@Entity
public class MatHead {
    @Id(autoincrement = true)
    private Long id;

    private String date;
    private String userName;
    private String desc;
    private String ftype;//2代表销售出库，3代表退货

    private String ghdwName;
    private String ghdwId;
    private String xsfsName;
    private String xsfsId;
    private String hybName;
    private String hybId;
    private String sklxName;
    private String sklxId;
    private String ywyName;
    private String ywyId;
    private String kfdhName;
    private String kfdhId;
    private String fhckName;
    private String fhckId;

    @ToMany(referencedJoinProperty = "headId")
    private List<BackMatBean> mats;

    @ToMany(referencedJoinProperty = "headId")
    private List<MatBeanCount> matBC;

    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;

    /** Used for active entity operations. */
    @Generated(hash = 381073400)
    private transient MatHeadDao myDao;

    @Generated(hash = 1192011308)
    public MatHead(Long id, String date, String userName, String desc, String ftype,
            String ghdwName, String ghdwId, String xsfsName, String xsfsId,
            String hybName, String hybId, String sklxName, String sklxId,
            String ywyName, String ywyId, String kfdhName, String kfdhId,
            String fhckName, String fhckId) {
        this.id = id;
        this.date = date;
        this.userName = userName;
        this.desc = desc;
        this.ftype = ftype;
        this.ghdwName = ghdwName;
        this.ghdwId = ghdwId;
        this.xsfsName = xsfsName;
        this.xsfsId = xsfsId;
        this.hybName = hybName;
        this.hybId = hybId;
        this.sklxName = sklxName;
        this.sklxId = sklxId;
        this.ywyName = ywyName;
        this.ywyId = ywyId;
        this.kfdhName = kfdhName;
        this.kfdhId = kfdhId;
        this.fhckName = fhckName;
        this.fhckId = fhckId;
    }

    @Generated(hash = 234940637)
    public MatHead() {
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getDate() {
        return this.date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getUserName() {
        return this.userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getDesc() {
        return this.desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getFtype() {
        return this.ftype;
    }

    public void setFtype(String ftype) {
        this.ftype = ftype;
    }

    public String getGhdwName() {
        return this.ghdwName;
    }

    public void setGhdwName(String ghdwName) {
        this.ghdwName = ghdwName;
    }

    public String getGhdwId() {
        return this.ghdwId;
    }

    public void setGhdwId(String ghdwId) {
        this.ghdwId = ghdwId;
    }

    public String getXsfsName() {
        return this.xsfsName;
    }

    public void setXsfsName(String xsfsName) {
        this.xsfsName = xsfsName;
    }

    public String getXsfsId() {
        return this.xsfsId;
    }

    public void setXsfsId(String xsfsId) {
        this.xsfsId = xsfsId;
    }

    public String getHybName() {
        return this.hybName;
    }

    public void setHybName(String hybName) {
        this.hybName = hybName;
    }

    public String getHybId() {
        return this.hybId;
    }

    public void setHybId(String hybId) {
        this.hybId = hybId;
    }

    public String getSklxName() {
        return this.sklxName;
    }

    public void setSklxName(String sklxName) {
        this.sklxName = sklxName;
    }

    public String getSklxId() {
        return this.sklxId;
    }

    public void setSklxId(String sklxId) {
        this.sklxId = sklxId;
    }

    public String getYwyName() {
        return this.ywyName;
    }

    public void setYwyName(String ywyName) {
        this.ywyName = ywyName;
    }

    public String getYwyId() {
        return this.ywyId;
    }

    public void setYwyId(String ywyId) {
        this.ywyId = ywyId;
    }

    public String getKfdhName() {
        return this.kfdhName;
    }

    public void setKfdhName(String kfdhName) {
        this.kfdhName = kfdhName;
    }

    public String getKfdhId() {
        return this.kfdhId;
    }

    public void setKfdhId(String kfdhId) {
        this.kfdhId = kfdhId;
    }

    public String getFhckName() {
        return this.fhckName;
    }

    public void setFhckName(String fhckName) {
        this.fhckName = fhckName;
    }

    public String getFhckId() {
        return this.fhckId;
    }

    public void setFhckId(String fhckId) {
        this.fhckId = fhckId;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 1749637941)
    public List<BackMatBean> getMats() {
        if (mats == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            BackMatBeanDao targetDao = daoSession.getBackMatBeanDao();
            List<BackMatBean> matsNew = targetDao._queryMatHead_Mats(id);
            synchronized (this) {
                if (mats == null) {
                    mats = matsNew;
                }
            }
        }
        return mats;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 1697019611)
    public synchronized void resetMats() {
        mats = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 1131363260)
    public List<MatBeanCount> getMatBC() {
        if (matBC == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            MatBeanCountDao targetDao = daoSession.getMatBeanCountDao();
            List<MatBeanCount> matBCNew = targetDao._queryMatHead_MatBC(id);
            synchronized (this) {
                if (matBC == null) {
                    matBC = matBCNew;
                }
            }
        }
        return matBC;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 1518912401)
    public synchronized void resetMatBC() {
        matBC = null;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1139534099)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getMatHeadDao() : null;
    }


}
